package com.lisynet.tools.mytools.annotation;

//import org.apache.shardingsphere.api.hint.HintManager;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * @author lisy
 * @Date 2022/1/17 14:48
 */
@Aspect
@Component
public class MasterRouteOnlyImpl {
    @Pointcut("@annotation(com.lisynet.tools.mytools.annotation.MasterRouteOnly)")
    public void pointCut() {}

    @Around("pointCut()")
    public Object aroundGetConnection(final ProceedingJoinPoint pjp) throws Throwable {
//        HintManager hintManager = HintManager.getInstance();
//        hintManager.setMasterRouteOnly();
        try {
            return pjp.proceed();
        } finally {
//            hintManager.close();
        }
    }
}
